package cn.rongdao.jrkabao.ui.creditcard.uicomponent;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.mifengkong.frtools.util.FRImageLoad;
import com.mifengkong.frtools.util.FRString;

import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.bean.creditcard.CreditCardBalanceBean;

/**
 * Created by jack on 2017/9/11
 */

public class CreditCardBalanceUIComponent extends RelativeLayout {
    public CreditCardBalanceUIComponent(Context context) {
        super(context);
    }

    public CreditCardBalanceUIComponent(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CreditCardBalanceUIComponent(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private ImageView ivAvatar;
    private TextView tvName;

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        ivAvatar = (ImageView) findViewById(R.id.iccb_iv_avatar);
        tvName = (TextView) findViewById(R.id.iccb_tv_name);
    }

    public void setContent(CreditCardBalanceBean data) {
        setVisibility(View.VISIBLE);
        FRImageLoad.loadImage(data.getBank_icon(), ivAvatar, R.drawable.icon_no_distinguish_bank);
        tvName.setText(FRString.valueOf(data.getBank_name()));
    }
}
